pdo: handle none cob_id correctly in __repr__#640
pdo: handle none cob_id correctly in __repr__#640stoicfeats wants to merge 1 commit intocanopen-python:masterfrom
Conversation
|
@acolomb please have a look into this, thanks. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hi and thanks for your contribution. I've experienced the issue you mention several times. It's usually a sign of weird ordering in the API usage, because you need to assign a valid COB ID by some means first. But sure, the We have several more places that can fail with the same error, mainly logging calls but also Would you mind checking the other places though, to fix other occurrences where the format strings can easily explode with |
fxes a crash when calling repr() on a pdomap that doesn't have a cob_id assigned yet.
before this, working in an interactive session would throw a typeerror if we evaluated uninitialized maps like node.rpdo[1].
the string formatter was trying to apply : X hex-formatting to a nonetype value.
this adds a quick inline fallback so it prints "unassigned" instead of throwing error on the console.